package com.msmall.community.common.dao.hibernate;

import java.util.List;

import com.msmall.base.dao.hibernate.BaseDaoHibernate;
import com.msmall.community.common.dao.SightDao;
import com.msmall.community.common.model.Sight;

public class SightDaoHibernate extends BaseDaoHibernate<Sight, Long> implements SightDao{

	public SightDaoHibernate(){
		super(Sight.class);
	}

	public Sight loadSightByName(String name) throws Exception {
		try{
			String queryString = "from Sight s where s.name=?";
			List list = getHibernateTemplate().find(queryString, name);
			if(list != null && list.size() > 0)
				return (Sight) list.get(0);
			return null;
		}catch(Exception e){
			throw e;
		}
	}
}
